from django.db import models


# Create your models here.
class VStuShow(models.Model):
    id = models.BigIntegerField(primary_key=True)
    username = models.CharField(max_length=100)
    realname = models.CharField(max_length=100)
    gendar = models.CharField(max_length=4, blank=True, null=True)
    birthday = models.DateField(blank=True, null=True)
    class_id = models.BigIntegerField()
    class_field = models.CharField(db_column='class',
                                   max_length=255)  # Field renamed because it was a Python reserved word.
    major = models.CharField(max_length=100)
    department = models.CharField(max_length=100)
    grade = models.CharField(max_length=100)
    stu_type = models.CharField(max_length=100)
    study_type = models.CharField(max_length=100)
    enteryear = models.CharField(max_length=100, blank=True, null=True)
    idtype = models.CharField(max_length=100, blank=True, null=True)
    idnumber = models.CharField(max_length=100, blank=True, null=True)
    nation = models.CharField(max_length=100, blank=True, null=True)
    enterdate = models.DateField()
    graduedate = models.DateField(blank=True, null=True)
    national_area = models.CharField(max_length=100, blank=True, null=True)
    ncee_score = models.CharField(max_length=100, blank=True, null=True)
    direction = models.CharField(max_length=100, blank=True, null=True)
    ncee_id = models.CharField(max_length=100, blank=True, null=True)
    ac_id = models.CharField(max_length=100, blank=True, null=True)
    highschool = models.CharField(max_length=100, blank=True, null=True)
    photo = models.BinaryField(blank=True, null=True)

    class Meta:
        managed = False
        db_table = 'V_STU_SHOW'


class UserInfo(models.Model):
    CHOICES = ((True, "是"), (False, "否"))
    USER_TYPE = ((0, "本科生"), (1, "研究生"), (2, "教职工"))
    userid = models.CharField(max_length=12, verbose_name="学工号", unique=True)
    phonenumber = models.CharField(max_length=11, verbose_name="电话号码")
    usertype = models.CharField(max_length=1, choices=USER_TYPE, default="0")
    residence = models.TextField()
    modifiy_date = models.DateTimeField(auto_now=True)
    create_date = models.DateTimeField(auto_now_add=True)


class JZG(models.Model):
    GANDER_TYPE = ((True, "男"), (False, "女"))
    userid = models.CharField(max_length=12, unique=True)
    realname = models.CharField(max_length=40)
    idnumber = models.CharField(max_length=40, null=True, blank=True)
    gander = models.BooleanField(choices=GANDER_TYPE)
    depid = models.IntegerField(null=True, blank=True)


class YJS(models.Model):
    GANDER_TYPE = ((True, "男"), (False, "女"))
    userid = models.CharField(max_length=12, unique=True)
    realname = models.CharField(max_length=20)
    idnumber = models.CharField(max_length=20, null=True, blank=True)
    gander = models.BooleanField(choices=GANDER_TYPE)
    depid = models.IntegerField()


class DW(models.Model):
    bm = models.IntegerField()
    cc = models.IntegerField()
    name = models.TextField()
    parent = models.IntegerField(null=True, blank=True)


class Settings(models.Model):
    key = models.CharField(max_length=12, default=None)
    value = models.TextField(default=None)


class Premissions(models.Model):
    TYPE = ((0, "本科生"), (1, "研究生"), (2, "教职工"))
    userid = models.CharField(max_length=12, unique=True)
    usertype = models.IntegerField(choices=TYPE)
    permission_type = models.TextField()
    permission = models.TextField(null=True, blank=True)


class JwToRenshi(models.Model):
    jwbm = models.IntegerField()
    name = models.CharField(max_length=50)
    renshi_bm = models.IntegerField()
